import 'package:flutter/material.dart';
/**
 * Create by laoge
 * on 2021/4/26 0026
 */

class ScaleScrollController extends ScrollController {

  static const ScaleDefaultDuration = Duration(milliseconds: 400);

  // 刻度间隔
  final int lineInterval ;
  // 刻度单位
  final double interval ;


  ScaleScrollController(this.lineInterval, this.interval);

  // 滚动到指定刻度，有动画
  void scrollTo(double value,{Duration duration = ScaleDefaultDuration,Curve curve = Curves.ease}){
    animateTo(value/interval*lineInterval,duration: duration,curve: curve);
  }

  // 跳转到指定刻度，无动画
  void goTo(double value){
    jumpTo(value/interval*lineInterval);
  }

}
